import { Injectable } from '@nestjs/common';
// import { KsDto } from './dto/ks.dto';
import { HttpService } from '@nestjs/axios';

import { BaiduCloudClient } from 'utils/baiduCloudClient';
import { ImportDataDto } from './dto/importData.dto';
import { DataInfoDto } from './dto/dataInfo.dto';
import { DataStatusDto } from './dto/dataStatus.dto';


@Injectable()
export class LargeModel2Service {
  constructor(private httpService: HttpService) {}

  //NOTE(@date:2023-12-25 13:31:05 陈谦): 数据集导入
  async importDataBase(ImportDataDto: ImportDataDto): Promise<any> {
    console.log('ImportDataDto======', ImportDataDto);

    const temp: BaiduCloudClientTypes = {
      request: {
        config: {
          path: ImportDataDto.path,
        },
        args: {
          body: JSON.stringify({
            datasetId: ImportDataDto.datasetId,
            annotated: Boolean(ImportDataDto.annotated),
            importFrom: Number(ImportDataDto.importFrom),
            files: ImportDataDto.files,
          }),
          params: {},
        },
      },
    };
    console.log('config====', temp);
    const client = new BaiduCloudClient(temp);
    client.init();
    const res = await client.sendRequest();
    return res;
  }

  //NOTE(@date:2023-12-25 13:31:05 陈谦): 数据集详情
  async dataInfoDto(DataInfoDto: DataInfoDto): Promise<any> {
    console.log('DataInfoDto======', DataInfoDto);

    const temp: BaiduCloudClientTypes = {
      request: {
        config: {
          path: DataInfoDto.path,
        },
        args: {
          body: JSON.stringify({
            datasetId: DataInfoDto.datasetId,
          }),
          params: {},
        },
      },
    };
    console.log('config====', temp);
    const client = new BaiduCloudClient(temp);
    client.init();
    const res = await client.sendRequest();
    return res;
  }

  //NOTE(@date:2023-12-25 13:31:05 陈谦): 数据集状态
  async dataStatusDto(DataStatusDto: DataStatusDto): Promise<any> {
    console.log('DataStatusDto======', DataStatusDto);

    const temp: BaiduCloudClientTypes = {
      request: {
        config: {
          path: DataStatusDto.path,
        },
        args: {
          body: JSON.stringify({
            datasetIds: DataStatusDto.datasetIds,
          }),
          params: {},
        },
      },
    };
    console.log('config====', temp);
    const client = new BaiduCloudClient(temp);
    client.init();
    const res = await client.sendRequest();
    return res;
  }
}
